/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cr.ac.una.sive.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author claribel
 */
@Entity
@Table(name = "HORARIO_USUARIO", catalog = "", schema = "UNA_SIVE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HorarioUsuario.findAll", query = "SELECT h FROM HorarioUsuario h"),
    @NamedQuery(name = "HorarioUsuario.findByIdHorarioUsuario", query = "SELECT h FROM HorarioUsuario h WHERE h.idHorarioUsuario = :idHorarioUsuario"),
    @NamedQuery(name = "HorarioUsuario.findByDia", query = "SELECT h FROM HorarioUsuario h WHERE h.dia = :dia"),
    @NamedQuery(name = "HorarioUsuario.findByHoraEntrada", query = "SELECT h FROM HorarioUsuario h WHERE h.horaEntrada = :horaEntrada"),
    @NamedQuery(name = "HorarioUsuario.findByHoraSalida", query = "SELECT h FROM HorarioUsuario h WHERE h.horaSalida = :horaSalida")})
public class HorarioUsuario implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SQHORARIO_USUARIO")
    @SequenceGenerator(name="SQHORARIO_USUARIO", sequenceName = "SQ_HORARIO_USUARIO",allocationSize=1)
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_HORARIO_USUARIO", nullable = false, precision = 0, scale = -127)
    private BigDecimal idHorarioUsuario;
    @Size(max = 100)
    @Column(name = "DIA", length = 100)
    private String dia;
    @Column(name = "HORA_ENTRADA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaEntrada;
    @Column(name = "HORA_SALIDA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date horaSalida;
    @JoinColumn(name = "REGISTRO_HORARIO", referencedColumnName = "ID_REGISTRO_HORARIO")
    @ManyToOne(fetch = FetchType.EAGER)
    private RegistroHorario registroHorario;

    public HorarioUsuario() {
    }

    public HorarioUsuario(BigDecimal idHorarioUsuario) {
        this.idHorarioUsuario = idHorarioUsuario;
    }

    public BigDecimal getIdHorarioUsuario() {
        return idHorarioUsuario;
    }

    public void setIdHorarioUsuario(BigDecimal idHorarioUsuario) {
        this.idHorarioUsuario = idHorarioUsuario;
    }

    public String getDia() {
        return dia;
    }

    public void setDia(String dia) {
        this.dia = dia;
    }

    public Date getHoraEntrada() {
        return horaEntrada;
    }

    public void setHoraEntrada(Date horaEntrada) {
        this.horaEntrada = horaEntrada;
    }

    public Date getHoraSalida() {
        return horaSalida;
    }

    public void setHoraSalida(Date horaSalida) {
        this.horaSalida = horaSalida;
    }

    public RegistroHorario getRegistroHorario() {
        return registroHorario;
    }

    public void setRegistroHorario(RegistroHorario registroHorario) {
        this.registroHorario = registroHorario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHorarioUsuario != null ? idHorarioUsuario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HorarioUsuario)) {
            return false;
        }
        HorarioUsuario other = (HorarioUsuario) object;
        if ((this.idHorarioUsuario == null && other.idHorarioUsuario != null) || (this.idHorarioUsuario != null && !this.idHorarioUsuario.equals(other.idHorarioUsuario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cr.ac.una.sive.entidad.HorarioUsuario[ idHorarioUsuario=" + idHorarioUsuario + " ]";
    }
    
}
